/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
using System;
using System.Collections.Generic;

using Aliyun.Acs.Core.Transform;
using Aliyun.Acs.aegis.Model.V20161111;

namespace Aliyun.Acs.aegis.Transform.V20161111
{
    public class DescribeRiskTypeResponseUnmarshaller
    {
        public static DescribeRiskTypeResponse Unmarshall(UnmarshallerContext context)
        {
			DescribeRiskTypeResponse describeRiskTypeResponse = new DescribeRiskTypeResponse();

			describeRiskTypeResponse.HttpResponse = context.HttpResponse;
			describeRiskTypeResponse.RequestId = context.StringValue("DescribeRiskType.RequestId");
			describeRiskTypeResponse.Count = context.IntegerValue("DescribeRiskType.Count");

			List<DescribeRiskTypeResponse.DescribeRiskType_RiskType> describeRiskTypeResponse_riskTypes = new List<DescribeRiskTypeResponse.DescribeRiskType_RiskType>();
			for (int i = 0; i < context.Length("DescribeRiskType.RiskTypes.Length"); i++) {
				DescribeRiskTypeResponse.DescribeRiskType_RiskType riskType = new DescribeRiskTypeResponse.DescribeRiskType_RiskType();
				riskType.TypeName = context.StringValue("DescribeRiskType.RiskTypes["+ i +"].TypeName");
				riskType.Alias = context.StringValue("DescribeRiskType.RiskTypes["+ i +"].Alias");
				riskType.WarnCount = context.StringValue("DescribeRiskType.RiskTypes["+ i +"].WarnCount");

				List<DescribeRiskTypeResponse.DescribeRiskType_RiskType.DescribeRiskType_SubType> riskType_subTypes = new List<DescribeRiskTypeResponse.DescribeRiskType_RiskType.DescribeRiskType_SubType>();
				for (int j = 0; j < context.Length("DescribeRiskType.RiskTypes["+ i +"].SubTypes.Length"); j++) {
					DescribeRiskTypeResponse.DescribeRiskType_RiskType.DescribeRiskType_SubType subType = new DescribeRiskTypeResponse.DescribeRiskType_RiskType.DescribeRiskType_SubType();
					subType.WarnCount = context.StringValue("DescribeRiskType.RiskTypes["+ i +"].SubTypes["+ j +"].WarnCount");
					subType.TypeName = context.StringValue("DescribeRiskType.RiskTypes["+ i +"].SubTypes["+ j +"].TypeName");
					subType.Alias = context.StringValue("DescribeRiskType.RiskTypes["+ i +"].SubTypes["+ j +"].Alias");

					riskType_subTypes.Add(subType);
				}
				riskType.SubTypes = riskType_subTypes;

				describeRiskTypeResponse_riskTypes.Add(riskType);
			}
			describeRiskTypeResponse.RiskTypes = describeRiskTypeResponse_riskTypes;
        
			return describeRiskTypeResponse;
        }
    }
}
